home *** CD-ROM | disk | FTP | other *** search
/ Java for 3D & VRML Worlds / Java for 3d and VRML Worlds.iso / vs / browser / cpb10ebx.exe / DATA.Z / manual.java < prev    next >
Text File  |  1996-10-16  |  1KB  |  65 lines

  1. /*
  2.  *    File    : manual.java (Script for Community Place)
  3.  *    Version : 2.0- 1996.09.11
  4.  *    Auther  : cori co.
  5.  *
  6.  *    Copyright(C) 1996 Sony Corporation. All rights reserved.
  7.  */
  8.  
  9. import vrml.*;
  10. import vrml.field.*;
  11. import vrml.node.*;
  12. import java.util.*;
  13. import vs.*;
  14.  
  15.  
  16. /* This is a sample script for event handler.*/
  17. public class manual extends Script {
  18.     SFBool        CubeSw;
  19.     boolean        CubeRotateFlg = false;
  20.  
  21.  
  22.     /*
  23.      * Initialize
  24.      */
  25.     public void initialize() {
  26.         CubeSw            = (SFBool) getEventOut( "Cube_switch" );
  27.     }
  28.  
  29.  
  30.     /*
  31.      * eventIn
  32.      */
  33.     public void processEvent( Event e ) {
  34.         String name = e.getName();
  35.  
  36.         if ( name.equals( "CubeClick" )) {
  37.             CubeClick( (ConstSFBool)e.getValue() );
  38.         } else {
  39.             ;
  40.         }
  41.     }
  42.  
  43.  
  44.     /*
  45.      * Clicked on the cube
  46.      */
  47.     public void CubeClick( ConstSFBool state ) {
  48.  
  49.         if ( !state.getValue() ) {            /* != mouseDown */
  50.             if ( CubeRotateFlg == false ) {
  51.                 CubeRotateFlg = true;
  52.                 CubeSw.setValue( true );
  53.             } else {
  54.                 CubeRotateFlg = false;
  55.                 CubeSw.setValue( false );
  56.             }
  57.         }
  58.     }
  59.  
  60.  
  61. }
  62.  
  63.  
  64.  
  65.